﻿using System;
using StarClub.BLL;

namespace StarClub.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;
            if (Session["CodeState"] == null)
                return;
            if (!txbCheckCode.Text.Trim().ToUpper().Equals(Session["CodeState"].ToString()))
            {
                lblmsg.Style["display"] = "block";
                lblmsg.InnerText = "验证码有误";
                return;
            }
            if (!LoginFacade.Login(this.txbLoginName.Text.Trim(), this.txbPassWord.Text.Trim(), out msg))
            {
                lblmsg.Style["display"] = "block";
                lblmsg.InnerText = msg;
                return;
            }
            if (Request.QueryString["returnUrl"] != null)
            {
                Response.Redirect(Request.QueryString["returnUrl"].ToString());
                return;
            }
            Response.Redirect("Admin/");
        }

    }
}
